(function ($){
    Drupal.behaviors.programlist = {
        attach: function(context, settings) {
            $('#edit-class').change(function(){
               for(j = 0; j <= 15; ++j){
                    $('#edit-list-column-'+j).attr('checked', true);
                }
                
            });
           
          
            for(j = 0; j <= 15; ++j){
                $('#edit-list-column-'+j).click(function(){
                    var my_id = $(this).attr('id');
                    var length = my_id.length;
                    var id_num = my_id.substring(17, length);
                    var k = parseInt(id_num, 10) + 5;
                                      
                    if (this.checked){
                        $('#tableresult td:nth-child('+ k +'),th:nth-child('+ k + ')').show();
                       
                    }else{
                        $('#tableresult td:nth-child('+ k  +'),th:nth-child('+ k+')').hide();
            
                    }
                                       
                }); 
            }                      
        }
    }
}(jQuery));
            
           